//
//  MePayment.h
//  MeAppBox
//
//  Created by absir on 12-5-16.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>

@protocol PayCallBack

@required
-(void) payResult:(int) result : (NSString *) identifier : (NSString *) receipt :(NSString *) reason;

@end

//字符串处理
@interface NSData(AESAdditions)
- (NSData *)subDataFromDest:(char *)dest To:(char *)to;
- (NSData *)dataBase64Encode;
- (NSString *)stringBase64Encode;
- (NSData *)dataBase64Decode;
- (NSData *)AES128EncryptWithKey:(NSString *)key;
- (NSData *)AES128DecryptWithKey:(NSString *)key;
@end

enum {
    _ePyt_Failed,
    _ePyt_Success,
};

@interface MePayment : NSObject<SKProductsRequestDelegate,SKPaymentTransactionObserver>
{
    BOOL loop_;
    NSString *loadingText_;
}
@property(nonatomic)int status;
@property(nonatomic, retain)NSArray *products;
@property(retain,nonatomic) NSObject<PayCallBack> *callFunc;
//@property(nonatomic, retain)MeCallFunc *callFunc;

//静态返回
+ (id)shared;

//是否可以付费
+ (BOOL)canPayment;

//子线程载入提示
- (void)loadingText:(NSString *)text;

//读取
- (void)readProduct:(NSString *)product;
- (void)readProducts:(NSSet *)products;

//购买
- (int)buyProduct:(NSString *)product;

@end
